package com.sam.im.heiqun.uis.adapters;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.sam.im.heiqun.R;
import com.yuyh.library.utils.GlideUtils;

/**
 * Created by wangguodong on 2017/8/21.
 */

public class AtHeadAdapter extends RecyclerView.Adapter <AtHeadAdapter.ViewHold>{
    private static final String TAG = "SendCircleActivity";
    private Context mContext ;
    private String [] datas ;

    public AtHeadAdapter (Context mContext, String [] datas){
        this.mContext = mContext ;
//        this.datas = null==datas?new String[0]:datas ;
        this.datas = datas ;
    }

    @Override
    public AtHeadAdapter.ViewHold onCreateViewHolder(ViewGroup parent, int viewType) {
        View headView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_at_head, parent, false);
        return new ViewHold(headView);
    }

    @Override
    public void onBindViewHolder(AtHeadAdapter.ViewHold holder, int position) {
        GlideUtils.loadCircleImage(mContext,datas[position],holder.image_head);

    }

    @Override
    public int getItemCount() {
        return null==datas?0:datas.length;
    }

    class ViewHold extends RecyclerView.ViewHolder{

        ImageView image_head ;

        public ViewHold(View itemView) {
            super(itemView);
            image_head = (ImageView) itemView.findViewById(R.id.image_head);
        }
    }

}
